let xm = /^[\u4e00-\u9fa5]{2,6}$/; //姓名
let myreg = /^[1][3,4,5,6.7,8,9][0-9]{9}$/ //手机号码正则
let patten = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/ //密码正则
let reg = /\S/; //空
let _IDRe18 = /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
let text4 = "身份证号码错误"
let text3 = "验证码不能为空"
let text2 = "请输正确密码"
let text = "请输入正确的账号"
let text0 = "输入有误"

var oname = document.getElementById("name")
var sfz = document.getElementById("sfz")
var input = document.querySelectorAll("#password , #phone ,#yzm ,#text")

var arrdiv=[
	"ospan","ospan2","ospan3","ospan4",
           "ospan5","ospan6","ospan7"
]

for (let i = 0; i < arrdiv.length; i++) {
	 arrdiv[i]=document.createElement("div")
	// console.log(arrdiv[i]);

}


//val1 对象 val2正则 //内容
function otest(val1, val2, vla3, vla4, vla5) {
	val1.onblur = function () {
		var s = val2.test(val1.value)
		if (!s) {
			this.parentNode.appendChild(vla4, this)
			//ospan.classList.add("ys")
			vla4.innerHTML = vla3
			vla4.classList.add(vla5)
			this.style.borderColor = "red"
		} else {
			vla4.remove()
			this.style.borderColor = "lightgreen"
		}
	}
}


otest(oname, xm, text0, arrdiv[0], "ys")
otest(sfz, _IDRe18, text4, arrdiv[1], "ys")
otest(input[0],patten,text2,arrdiv[2],"ys")
otest(input[1],patten,text2,arrdiv[3],"ys")
otest(input[2],myreg,text0,arrdiv[4],"ys")
otest(input[3],reg,text3,arrdiv[5],"ys2")
otest(input[4],reg,text3,arrdiv[6],"ys3")





var btn=document.getElementById("create")
// btn.onclick=function(){
 
// }

// var Cj=document.querySelector(".chunju")
// var Jd=document.querySelector(".jiedao")

// var tab_cont=document.querySelectorAll(".jiedao , .chunju")

// var tab=document.querySelectorAll("#street ,#rusticate")
// console.log(tab);
// console.log(tab_cont);

// tab.addEventListener("click",function(e){
// 	console.log(e.target instanceof Object);
//    if(e.target=="input"){
//   e.target.onclick=function(){
// 	  console.log(1);
//   }
// }
// })
// tab.forEach((time,index) => {
// 	time.index=index
// 	time.onclick=shou

// });
// function shou(){
// 	console.log(this.index);
// 	tab_cont[this.index].style.display="block"
// }
